package com.ybkj.daijia.server.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;

/**
 * 起步开始时段
 *
 * @author Shine
 */
public class ChargeStartTime implements Serializable {

    private static final long serialVersionUID = 1L;
    private Long id;
    private Date created;
    private Date updated;
    private Integer startHour;// 开始时间 时

    private Integer startMinute;// 开始时间 分

    private Integer endHour;// 结束时间 时

    private Integer endMinute;// 结束时间 分

    private BigDecimal cost; // 单价（起步价）

    private Double qblc;// 起步里程(最后超过xx公里)

    private List<ChargeStartDistance> chargeStartDistances;

    private Integer mfdhsj;// 免费等候时间(分钟);
    private BigDecimal dhsjAtonceCost; // 超过mfdhsj，立马收费dhsjAtonceCost元
    private Integer dhsjUnit;// 等候时间单位(分钟);
    private Integer dhsjThresholdt;// 等候时间阀值(分钟);
    private BigDecimal dhsjCost; // 等候时间收费
    private Double djglUnit;// 代驾公里单位(公里);
    private Double djglThresholdt;// 代驾公里阀值(公里);
    private BigDecimal djglCost; // 代驾公里收费
    private Long areaId;
    /*重量收费*/
    private Double cgzl;// 起步重量(最后超过xx重量)
    private Double zlUnit;//重量单位
    private Double zlThresholdt;// 重量阀值
    private BigDecimal zlCost; // 重量收费
    private List<ChargeStartNewWeight> chargeStartNewWeights;
    /*时间收费*/
    private Integer qbsj;// 开始代驾起步时间(分钟)
    /*重量收费*/
    private Integer djsjUnit;// 代驾时间单位(分钟);
    private Integer djsjThresholdt;// 代驾时间阀值(分钟);
    private BigDecimal djsjCost; // 代驾时间收费

    @Override
    public String toString() {
        return "ChargeStartTime{" +
            "id=" + id +
            ", created=" + created +
            ", updated=" + updated +
            ", startHour=" + startHour +
            ", startMinute=" + startMinute +
            ", endHour=" + endHour +
            ", endMinute=" + endMinute +
            ", cost=" + cost +
            ", qblc=" + qblc +
            ", chargeStartDistances=" + chargeStartDistances +
            ", mfdhsj=" + mfdhsj +
            ", dhsjAtonceCost=" + dhsjAtonceCost +
            ", dhsjUnit=" + dhsjUnit +
            ", dhsjThresholdt=" + dhsjThresholdt +
            ", dhsjCost=" + dhsjCost +
            ", djglUnit=" + djglUnit +
            ", djglThresholdt=" + djglThresholdt +
            ", djglCost=" + djglCost +
            ", areaId=" + areaId +
            ", cgzl=" + cgzl +
            ", zlUnit=" + zlUnit +
            ", zlThresholdt=" + zlThresholdt +
            ", zlCost=" + zlCost +
            ", chargeStartNewWeights=" + chargeStartNewWeights +
            ", qbsj=" + qbsj +
            ", djsjUnit=" + djsjUnit +
            ", djsjThresholdt=" + djsjThresholdt +
            ", djsjCost=" + djsjCost +
            '}';
    }
    /*时间收费*/

    public Integer getStartHour() {
        return startHour;
    }

    public void setStartHour(Integer startHour) {
        this.startHour = startHour;
    }

    public Double getCgzl() {
        if (null == cgzl) {
            return 0d;
        }
        return cgzl;
    }

    public void setCgzl(Double cgzl) {
        this.cgzl = cgzl;
    }

    public Double getZlUnit() {
        if (null == zlUnit) {
            return 0d;
        }
        return zlUnit;
    }

    public void setZlUnit(Double zlUnit) {
        this.zlUnit = zlUnit;
    }

    public Double getZlThresholdt() {
        if (null == zlThresholdt) {
            return 0d;
        }
        return zlThresholdt;
    }

    public void setZlThresholdt(Double zlThresholdt) {
        this.zlThresholdt = zlThresholdt;
    }

    public BigDecimal getZlCost() {
        if (null == zlCost) {
            return BigDecimal.ZERO;
        }
        return zlCost;
    }

    public void setZlCost(BigDecimal zlCost) {
        this.zlCost = zlCost;
    }

    public Integer getStartMinute() {
        return startMinute;
    }

    public void setStartMinute(Integer startMinute) {
        this.startMinute = startMinute;
    }

    public Integer getEndHour() {
        return endHour;
    }

    public void setEndHour(Integer endHour) {
        this.endHour = endHour;
    }

    public Integer getEndMinute() {
        return endMinute;
    }

    public void setEndMinute(Integer endMinute) {
        this.endMinute = endMinute;
    }

    public BigDecimal getCost() {
        if (null == cost) {
            return BigDecimal.ZERO;
        }
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Double getQblc() {
        if (null == qblc) {
            return 0d;
        }
        return qblc;
    }

    public void setQblc(Double qblc) {
        this.qblc = qblc;
    }

    public Integer getMfdhsj() {
        if (null == mfdhsj) {
            return 0;
        }
        return mfdhsj;
    }

    public void setMfdhsj(Integer mfdhsj) {
        this.mfdhsj = mfdhsj;
    }

    public Integer getDhsjUnit() {
        if (null == dhsjUnit) {
            return 0;
        }
        return dhsjUnit;
    }

    public void setDhsjUnit(Integer dhsjUnit) {
        this.dhsjUnit = dhsjUnit;
    }

    public Integer getDhsjThresholdt() {
        if (null == dhsjThresholdt) {
            return 0;
        }
        return dhsjThresholdt;
    }

    public void setDhsjThresholdt(Integer dhsjThresholdt) {
        this.dhsjThresholdt = dhsjThresholdt;
    }

    public BigDecimal getDhsjCost() {
        if (null == dhsjCost) {
            return BigDecimal.ZERO;
        }
        return dhsjCost;
    }

    public void setDhsjCost(BigDecimal dhsjCost) {
        this.dhsjCost = dhsjCost;
    }

    public Double getDjglUnit() {
        if (null == djglUnit) {
            return 0d;
        }
        return djglUnit;
    }

    public void setDjglUnit(Double djglUnit) {
        this.djglUnit = djglUnit;
    }

    public Double getDjglThresholdt() {
        if (null == djglThresholdt) {
            return 0d;
        }
        return djglThresholdt;
    }

    public void setDjglThresholdt(Double djglThresholdt) {
        this.djglThresholdt = djglThresholdt;
    }

    public BigDecimal getDjglCost() {
        if (null == djglCost) {
            return BigDecimal.ZERO;
        }
        return djglCost;
    }

    public void setDjglCost(BigDecimal djglCost) {
        this.djglCost = djglCost;
    }

    public Long getAreaId() {
        return areaId;
    }

    public void setAreaId(Long areaId) {
        this.areaId = areaId;
    }

    public Integer getQbsj() {
        if (null == qbsj) {
            return 0;
        }
        return qbsj;
    }

    public void setQbsj(Integer qbsj) {
        this.qbsj = qbsj;
    }

    public BigDecimal getDhsjAtonceCost() {
        if (null == dhsjAtonceCost) {
            return BigDecimal.ZERO;
        }
        return dhsjAtonceCost;
    }

    public void setDhsjAtonceCost(BigDecimal dhsjAtonceCost) {
        this.dhsjAtonceCost = dhsjAtonceCost;
    }

    public Integer getDjsjUnit() {
        if (null == djsjUnit) {
            return 0;
        }
        return djsjUnit;
    }

    public void setDjsjUnit(Integer djsjUnit) {
        this.djsjUnit = djsjUnit;
    }

    public Integer getDjsjThresholdt() {
        if (null == djsjThresholdt) {
            return 0;
        }
        return djsjThresholdt;
    }

    public void setDjsjThresholdt(Integer djsjThresholdt) {
        this.djsjThresholdt = djsjThresholdt;
    }

    public BigDecimal getDjsjCost() {
        if (null == djsjCost) {
            return BigDecimal.ZERO;
        }
        return djsjCost;
    }

    public void setDjsjCost(BigDecimal djsjCost) {
        this.djsjCost = djsjCost;
    }

    public List<ChargeStartDistance> getChargeStartDistances() {
        if (!CollectionUtils.isEmpty(chargeStartDistances)) {
            for (int i = 0; i < chargeStartDistances.size(); i++) {
                if (null == chargeStartDistances.get(i).getStartdistance()) {
                    if (i == 0) {
                        chargeStartDistances.get(i).setStartdistance(0d);
                    } else {
                        chargeStartDistances.get(i)
                            .setStartdistance(chargeStartDistances.get(i - 1).getDistance());
                    }
                }
            }
        }
        return chargeStartDistances;
    }

    public void setChargeStartDistances(
        List<ChargeStartDistance> chargeStartDistances) {
        this.chargeStartDistances = chargeStartDistances;
    }


    public List<ChargeStartNewWeight> getChargeStartNewWeights() {
        if (!CollectionUtils.isEmpty(chargeStartNewWeights)) {
            for (int i = 0; i < chargeStartNewWeights.size(); i++) {
                if (null == chargeStartNewWeights.get(i).getStartweight()) {
                    if (i == 0) {
                        chargeStartNewWeights.get(i).setStartweight(0d);
                    } else {
                        chargeStartNewWeights.get(i)
                            .setStartweight(chargeStartNewWeights.get(i - 1).getWeight());
                    }
                }
            }
        }
        return chargeStartNewWeights;
    }

    public void setChargeStartNewWeights(List<ChargeStartNewWeight> chargeStartNewWeights) {
        this.chargeStartNewWeights = chargeStartNewWeights;
    }

    public boolean isEmpty() {
        if (null != startHour && null != startMinute && null != endHour
            && null != endMinute && null != cost) {
            return false;
        }
        return true;
    }


}
